<template>
<div class="use-window-scroll">
  <div v-text="`x: ${ x }, y: ${ y }`" />
  <button @click="x += 100">滚动X</button>
  <button @click="y += 100">滚动Y</button>
</div>
</template>
<script setup lang="ts">
import {useWindowScroll} from "@vueuse/core";

defineOptions({
  name: "UseWindowScroll"
})
const { x, y } = useWindowScroll({ behavior: 'smooth' })

</script>
<style scoped lang="css">
.use-window-scroll {
  width: 2000px;
  height: 2000px;
  background: pink;
}
</style>
